import requests
from bs4 import BeautifulSoup

url = 'https://www.douguo.com/jingxuan/0'
head_data = {
    # 字典，需要有一个键值对
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36'
}
html = requests.get(url, headers=head_data)

data = BeautifulSoup(html.text, 'lxml')

title = data.find_all('a', class_="cookname text-lips")
title = [i.text for i in title]

view = data.find_all('span', class_="view")
view = [i.text for i in view]

author = data.find_all('a', class_="author text-lips")
for i in author:
    print(i.img['alt'])
    print(i.img.get('alt'))
